import { Schema, Types, model } from 'mongoose'

// gpt智能体
const GptRobotSchema = new Schema(
  {
    user_id: {
      type: Types.ObjectId,
      ref: 'GptUser'
    },
    created_by: {
      type: String,
      required: true
    },
    cover: {
      type: String,
      required: true
    },
    status: {
      type: Number,
      default: 0,
      descripion: '0 公开;1 分享链接可见; 2:仅自己可见'
    },
    name: {
      type: String,
      required: true
    },
    share_link: {
      type: String,
      required: true
    },
    introduction: {
      type: String,
      required: true
    },
    model: {
      type: String,
      required: true,
      default: 'text',
      enum: ['text', 'getImg', 'text_audio', 'audio_text'] //文本生成，（图片生成，文本转语音，语音转文本，预置，只开放第一种）
    },
    chat_num: {
      // 每过一段时间同步一次
      type: Number,
      default: 0
    },
    // 开场白
    prologue:{
      type: String,
    },
    // 聊天灵感，紧随聊天信息
    prompt: {
      type: [String],
    },
  },
  { versionKey: false, timestamps: true }
)

export default model('GptRobot', GptRobotSchema, 'gpt_robots')
